Skip to content

Improve default behavior of string search (NUL = new line)#6573

Open
Rot127 wants to merge 2 commits into
rizinorg:devfrom
Rot127:str-search
Open

Improve default behavior of string search (NUL = new line)#6573
Rot127 wants to merge 2 commits into
rizinorg:devfrom
Rot127:str-search

Conversation

@Rot127

@Rot127 Rot127 commented Jun 28, 2026

Copy link
Copy Markdown
Member

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository.
  • I made sure to follow the project's coding style.
  • I've documented every RZ_API function and struct this PR changes.
  • I've added tests that prove my changes are effective (required for changes to RZ_API).
  • I've updated the Rizin book with the relevant information (if needed).
  • I've used AI tools to generate fully or partially these code changes and I'm sure the changes are not copyrighted by somebody else.

Detailed description

This adds some string search improvements which could be interpreted as a bug.
Because the default configuration is not sensible.

The string search (/z) use the default line endings which are not NUL bytes.
That is really weird in binaries, because a regex like .+ would match a NUL byte.
People could change the behavior by prefixing a regex with (*NUL) but who does this?

This PR changes the default behavior to interpret NUL as line ending.

Additionally, it allows now the d (dot all) and m (multiline) flag in combination with r.

Test plan

Added

Closing issues

...

That is the most intuitive option for binary searches.
The behavior can still be changed, as seen in the added example.
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.46154% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.90%. Comparing base (478117d) to head (9ca8c12).

Files with missing lines Patch % Lines
librz/util/regex.c 86.36% 2 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
librz/core/cmd_descs/cmd_descs.c 50.63% <ø> (ø)
librz/search/string_search.c 52.75% <100.00%> (ø)
librz/util/regex.c 66.97% <86.36%> (+0.75%) ⬆️

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 478117d...9ca8c12. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants